package model.entity;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Transient;

import model.business.Customer;
import model.business.device.DeviceCommand;
import model.business.device.DeviceState;

@Entity
@Table(name="Device")
public class Device {
	
	@Id
	@GeneratedValue(generator = "Dev_ID_Gen", strategy = GenerationType.IDENTITY)
	@SequenceGenerator(name = "Dev_ID_Gen", sequenceName = "Dev_SEQ_ID")
	private int id;
	private String model;
	private String detailInfo;
	
	private DeviceState state;
	
	@Transient
	private Customer customer;
	
	@Transient
	private List<DeviceCommand> commandList;
	
	public String getModel() {
		return model;
	}

	public void setModel(String model) {
		this.model = model;
	}

	public String getDetailInfo() {
		return detailInfo;
	}

	public void setDetailInfo(String detailInfo) {
		this.detailInfo = detailInfo;
	}

	public DeviceState getState() {
		return state;
	}

	public void setState(DeviceState state) {
		this.state = state;
	}

	public Customer getCustomer() {
		return customer;
	}

	public void setCustomer(Customer customer) {
		this.customer = customer;
	}

	public List<DeviceCommand> getCommandList() {
		return commandList;
	}

	public void setCommandList(List<DeviceCommand> commandList) {
		this.commandList = commandList;
	}

	public int getId() {
		return id;
	}
	
	@Override
	public String toString() {
		return "Device [id=" + id + ", model=" + model + ", detailInfo="
				+ detailInfo + ", state=" + state + ", customer=" + customer
				+ ", commandList=" + commandList + "]";
	}

	public Device() {
		this.customer = null;
		this.commandList = new ArrayList<DeviceCommand>();
	}
}
